<?php

namespace app\admin\model;

use think\Model;

class BaseModel extends Model
{
    public static function getInfo($id)
    {
        return static::find($id);
    }

    public static function addInfo($data)
    {
        try {
            $res = self::create($data);
            $msg = 'ok';
        } catch (\Exception $e) {
            $res = false;
            $msg = $e->getMessage();
        }
        return [$res, $msg];
    }

    public static function editInfo($data)
    {
        try {
            $res = self::update($data);
            $msg = 'ok';
        } catch (\Exception $e) {
            $res = false;
            $msg = $e->getMessage();
        }
        return [$res, $msg];
    }
}
